home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / PIELOGO.ARJ / PIXADDR1.INC < prev    next >
Text File  |  1992-01-25  |  854b  |  51 lines

  1. ;
  2. ;    this routine returns the pixel addr for ega modes
  3. ;    when given x and y coords
  4. ;
  5. ;    caller:         ax = y-coordinate
  6. ;                bx = x-cooordintat
  7. ;    
  8. ;    returns:        ah = bit mask
  9. ;                bx = byte offset in buffer
  10. ;                cl = number of bits to shift left
  11. ;                es = video buffer segment
  12. ;
  13. IF (vgmode EQ 10h) OR (vgmode EQ 0dh)
  14. pixadd    macro
  15.     push    dx
  16.     mov    dx,bpl        ; bytes per line
  17.     mul    dx
  18.     mov    cl,3
  19.     pop    dx
  20.     mov    ch,bl        ; save old x low part
  21.     shr    bx,cl
  22. ;    add    bx,vboff    ; add in offset
  23.     add    bx,ax        ; add in y offset
  24.     mov    cl,ch
  25.     and    cl,7
  26.     xor    cl,7
  27.     mov    ax,vgseg    ; load es with proper segment
  28.     mov    es,ax
  29.     mov    ah,1
  30.     endm
  31. ENDIF
  32. IF vgmode EQ 81h
  33. pixadd    macro
  34.     mov    cl,bl
  35.     shr    ax,1
  36.     rcr    bx,1
  37.     shr    ax,1
  38.     rcr    bx,1
  39.     shr    bx,1
  40.     mov    ah,bpl
  41.     mul    ah
  42.     add    bx,ax
  43.     add    bx,vboff
  44.     mov    ax,vgseg
  45.     mov    es,ax
  46.     and    cl,7
  47.     xor    cl,7
  48.     mov    ah,1
  49.     endm
  50. ENDIF
  51.